package jlib.component.net
{
	internal final class DataContainer
	{
		private var dataList:Array;
		public function DataContainer()
		{
			dataList = new Array;
		}
		
		public function addData(data:*): void
		{
			dataList.push(data);
		}
		
		public function removeData(data:*): void
		{
			removeDataAt(getIndex(data));
		}
		
		public function removeDataAt($index:int): void
		{
			dataList.splice($index,1);	
		}
		
		public function getDataAt($index:int): * 
		{
			return dataList[$index];	
		}
		
		public function getDataLength(): int
		{
			return dataList.length;	
		}
		
		public function getIndex($data:*): int
		{
			var idx:int = dataList.indexOf($data);
			if(idx < 0) throw(new Error('해당값을 찾지 못했습니다.'));
			return idx;
		}
		
	}//c
}